﻿<UserControl x:Class="EpiDashboard.Controls.VariablesDisplayControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../StyleDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="80" />
        </Grid.RowDefinitions>
        <DataGrid x:Name="dataGridMain" 
                         ItemsSource="{Binding Path=., IsAsync=True, FallbackValue=...}"   
                         AutoGenerateColumns="False"
              BorderThickness="0, 1, 0, 1"
                  Style="{StaticResource LineListDataGridStyle}"
              EnableRowVirtualization="False" 
              EnableColumnVirtualization="False"
              VirtualizingStackPanel.IsVirtualizing="True"
              VirtualizingStackPanel.VirtualizationMode="Recycling"
              CanUserAddRows="False"
              CanUserDeleteRows="False"
              CanUserReorderColumns="True"
              CanUserResizeColumns="True"
              CanUserResizeRows="False"
              CanUserSortColumns="False"
              SelectionUnit="FullRow" SelectionChanged="dataGridMain_SelectionChanged" CellEditEnding="dataGridMain_CellEditEnding" BeginningEdit="dataGridMain_BeginningEdit" AutoGeneratedColumns="dataGridMain_AutoGeneratedColumns">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Column Name" Width="250" MaxWidth="250" Binding="{Binding columnname}" IsReadOnly="True" />
                <DataGridTextColumn Header="Prompt" Width="250" MaxWidth="250" Binding="{Binding Prompt}" IsReadOnly="True">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="TextBlock">
                            <Setter Property="TextWrapping" Value="Wrap"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="Form Name" Width="200" MaxWidth="200" Binding="{Binding formname}" IsReadOnly="True" />
                <DataGridTextColumn Header="Page" Binding="{Binding Page}" IsReadOnly="True" />
                <DataGridTextColumn Header="Tab" Binding="{Binding Tab}" IsReadOnly="True" />
                <DataGridTextColumn Header="Data Type" Binding="{Binding datatype}" IsReadOnly="True" />
                <DataGridTextColumn Header="Epi Field Type" Binding="{Binding epifieldtype}" IsReadOnly="True" />
                <DataGridTextColumn Header="Table Name" Width="200" MaxWidth="200" Binding="{Binding tablename}" IsReadOnly="True" />
                <DataGridTextColumn Header="Definition" Width="320" MaxWidth="320" Binding="{Binding Definition}" IsReadOnly="True">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="TextBlock">
                            <Setter Property="TextWrapping" Value="Wrap"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="Items" Width="320" MaxWidth="320" Binding="{Binding Items}" IsReadOnly="True">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="TextBlock">
                            <Setter Property="TextWrapping" Value="Wrap"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
            </DataGrid.Columns>
        </DataGrid>
        
        <StackPanel Grid.Row="1" x:Name="panelVariables">
            <Label x:Name="lblVariableHeading" Style="{StaticResource PropertiesSubHeading}">
                <Label.Content>
                    <TextBlock x:Name="tblockContent">
                        
                    </TextBlock>
                </Label.Content></Label>
            
            <StackPanel Orientation="Horizontal" Visibility="Collapsed"> <!--Numeric-->
                <Label>Min: 0</Label>
                <Label>Max: 87</Label>
                <Label>Mean: 43</Label>
                <Label>Sum: 13443</Label>
            </StackPanel>

            <StackPanel x:Name="panelNumber" Orientation="Horizontal" Visibility="Collapsed"> <!--Decimal-->
                <Label x:Name="lblMin">Min:  </Label>
                <Label x:Name="lblMax">Max:  </Label>
                <Label x:Name="lblMean">Mean:  </Label>
                <Label x:Name="lblSum">Sum:  </Label>
            </StackPanel>

            <StackPanel x:Name="panelDate" Orientation="Horizontal" Visibility="Collapsed">
                <!--Decimal-->
                <Label x:Name="lblMinDate">Min: 1/1/0001</Label>
                <Label x:Name="lblMaxDate">Max: 12/31/2050</Label>
            </StackPanel>

            <StackPanel x:Name="panelString" Orientation="Horizontal" Visibility="Collapsed"> <!--Text-->
                <!--<Label>Distinct values: 11</Label>-->
            </StackPanel>

            <StackPanel x:Name="panelBoolean" Orientation="Horizontal" Visibility="Collapsed"> <!--Boolean-->
                <Label x:Name="lblTrue">True:  </Label>
                <Label x:Name="lblFalse">False:  </Label>
            </StackPanel>
        </StackPanel>
    </Grid>
</UserControl>
